﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Freshbox2._0.UI.Filters
{
    public class CheckLoginAttribute: System.Web.Mvc.ActionFilterAttribute
    {
        public bool IsCheck { get; set; }

        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            if (!IsCheck)
            {
                return;
            }
            if (filterContext.HttpContext.Session["CurrentUer"] == null)
            {
                filterContext.Result = new RedirectResult("~/Login/Index");
            }
        }
    }
}
    
    